package com.ethank.enums;

import com.ethank.entity.VoucherResponseVO;

import java.util.HashMap;

public enum AliBillFieldEnum {
    FLIGHTS("flights","详情","",1,false),
    INVOICEDETAILS("invoiceDetails","详情","",1,false),
    BillINVOICETYPE("billInvoiceType","发票类型","",1,true),
    /*
     *
     * 混贴发票 增值税
     *
     * */
    INVOICECODE("invoiceCode", "发票代码", "", 1,true),

    INVOICENUMBER("invoiceNumber", "发票号码", "", 1,true),

    PRINTEDINVOICECODE("printedInvoiceCode", "发票代码-机打", "", 1,false),

    PRINTEDINVOICENUMBER("printedInvoiceNumber", "发票号码-机打", "", 1,false),

    INVOICEDATE("invoiceDate", "开票日期", "", 2,false),

    MACHINECODE("machineCode", "机器编号", "", 1,false),

    CHECKCODE("checkCode", "校验码", "", 1,false),

    PURCHASERNAME("purchaserName", "购买方名称", "", 1,false),

    PURCHASERTAXNUMBER("purchaserTaxNumber", "购买方纳税人识别号", "", 1,false),

    PURCHASERCONTACTINFO("purchaserContactInfo", "受票方地址、电话", "", 1,false),

    PURCHASERBANKACCOUNTINFO("purchaserBankAccountInfo", "受票方开户行、账号", "", 1,false),

    PASSWORDAREA("passwordArea", "密码区", "", 1,false),

    INVOICEAMOUNTPRETAX("invoiceAmountPreTax", "不含税金额", "", 1,false),

    INVOICETAX("invoiceTax", "发票税额", "", 1,false),

    TOTALAMOUNTINWORDS("totalAmountInWords", "大写金额", "", 1,false),

    TOTALAMOUNT("totalAmount", "发票金额/总金额", "", 1,true),

    SELLERNAME("sellerName", "销售方名称", "", 1,false),

    SELLERTAXNUMBER("sellerTaxNumber", "销售方税号", "", 1,false),

    SELLERCONTACTINFO("sellerContactInfo", "销售方地址、电话", "", 1,false),

    SELLERBANKACCOUNTINFO("sellerBankAccountInfo", "销售方开户行、账号", "", 1,false),

    RECIPIENT("recipient", "收款人", "", 1,false),

    REVIEWER("reviewer", "复核人", "", 1,false),

    DRAWER("drawer", "开票人", "", 1,false),

    REMARKS("remarks", "备注", "", 1,false),

    TITLE("title", "标题", "", 1,false),

    FORMTYPE("formType", "发票联次", "", 1,false),

    INVOICETYPE("invoiceType", "发票类型", "", 1,false),

    SPECIALTAG("specialTag", "特殊标识信息", "", 1,false),

    ITEMNAME("itemName", "货物或应税劳务、服务名称", "", 1,false),

    SPECIFICATION("specification", "规格型号", "", 1,false),

    UNIT("unit", "单位", "", 1,false),

    QUANTITY("quantity", "数量", "", 1,false),

    UNITPRICE("unitPrice", "单价", "", 1,false),

    AMOUNT("amount", "金额", "", 1,true),

    TAXRATE("taxRate", "税率", "", 1,false),

    TAX("tax", "税额", "", 1,false),

    /*
     *
     * 火车票
     *
     * */

    // TYPE("type", "类型", "", 1,false),

    DEPARTURESTATION("departureStation", "出发站", "", 1,false),
    ARRIVALSTATION("arrivalStation", "到达站", "", 1,false),
    TRAINNUMBER("trainNumber", "车次", "", 1,false),
    DEPARTURETIME("departureTime", "开车时间", "", 2,false),
    SEATNUMBER("seatNumber", "座位号", "", 1,false),
    FARE("fare", "票价/金额", "", 1,false),
    SEATTYPE("seatType", "座位类型", "", 1,false),
    PASSENGERINFO("passengerInfo", "旅客信息", "", 1,false),
    PASSENGERNAME("passengerName", "旅客姓名", "", 1,false),
    TICKETNUMBER("ticketNumber", "票号", "", 1,true),
    TICKETCODE("ticketCode", "售票码", "", 1,true),
    SALEINFO("saleInfo", "售票车站信息", "", 1,false),
    TICKETGATE("ticketGate", "检票口", "", 1,false),

    /*
     *
     * 出租车票
     *
     * */
    //    TYPE("type", "类型"),
    //    INVOICECODE("invoiceCode", "发票代码"),
    //    INVOICENUMBER("invoiceNumber", "发票号码"),
    LICENSEPLATENUMBER("licensePlateNumber", "车牌号", "", 1,false),
    DATE("date", "日期", "", 2,false),
    PICKUPTIME("pickUpTime", "上车时间", "", 2,false),
    DROPOFFTIME("dropOffTime", "下车时间", "", 2,false),
    MILEAGE("mileage", "里程", "", 1,false),
    //    FARE("fare", "金额"),
    BILLTYPE("billType", "发票类型", "", 1,false),

    /*
     *
     * 客运车船票
     *
     * */
    //    TITLE("title", "标题"),
    //    FORMTYPE("formType", "发票联次"),
    //    INVOICECODE("invoiceCode", "发票代码"),
    //    INVOICENUMBER("invoiceNumber", "发票号"),
    //    DATE("date", "日期"),
    TIME("time", "时间", "", 2,false),
    //    DEPARTURESTATION("departureStation", "出发车站"),
    //    ARRIVALSTATION("arrivalStation", "到达车站"),
    //    TOTALAMOUNT("totalAmount", "总金额"),
    //    PASSENGERNAME("passengerName", "姓名"),
    IDCARDNO("idcardNo", "身份证号", "", 1,false),

    /*
     *
     * 定额发票
     *
     * */
    //    TYPE("type", "类型"),
    //    INVOICECODE("invoiceCode", "发票代码"),
    //    INVOICENUMBER("invoiceNumber", "发票号码"),
    AMOUNTINWORDS("AmountInWords", "大写金额", "", 1,false),
    CAPAMOUNT("Amount", "小写金额","",1,true),
    //    TITLE("title", "发票标题"),
    //    FORMTYPE("formType", "联次");

    /*
     *
     * 航空行程单
     *
     * */
    //    TYPE("type", "类型"),
    INTERNATIONALFLIGHTSIGN("internationalFlightSign", "国内国际标签", "", 1,false),
    SERIALNUMBER("serialNumber", "印刷序号", "", 1,false),
    //    PASSENGERNAME("passengerName", "旅客姓名"),
    IDCARDNUMBER("idCardNumber", "有效身份证号码", "", 1,false),
    ENDORSEMENT("endorsement", "签注", "", 1,false),
    //    FARE("fare", "票价"),
    CAACDEVELOPMENTFUND("caacDevelopmentFund", "民航发展基金", "", 1,false),
    FUELSURCHARGE("fuelSurcharge", "燃油附加费", "", 1,false),
    //    TOTALAMOUNT("totalAmount", "合计"),
    //    TICKETNUMBER("ticketNumber", "电子客票号码"),
    VALIDATIONCODE("validationCode", "验证码", "", 1,false),
    PROMPTMESSAGE("promptMessage", "提示信息", "", 1,false),
    INSURANCE("insurance", "保险费", "", 1,false),
    AGENTCODE("agentCode", "销售单位代号", "", 1,false),
    ISSUECOMPANY("issueCompany", "填开单位", "", 1,false),
    ISSUEDATE("issueDate", "填开日期", "", 2,false),
    PNRCODE("pnrCode", "PNR 码", "", 1,false),
    OTHERTAXES("otherTaxes", "其他税费", "", 1,false),
    //    DEPARTURESTATION("departureStation", "出发站"),
    //    ARRIVALSTATION("arrivalStation", "到达站"),
    CARRIER("carrier", "承运人", "", 1,false),
    FLIGHTNUMBER("flightNumber", "航班号", "", 1,false),
    CABINCLASS("cabinClass", "舱位等级", "", 1,false),
    FLIGHTDATE("flightDate", "乘机日期", "", 2,false),
    FLIGHTTIME("flightTime", "乘机时间", "", 2,false),
    SEATCLASS("seatClass", "座位等级", "", 1,false),
    VALIDFROMDATE("validFromDate", "客票生效日期", "", 2,false),
    VALIDTODATE("validToDate", "有效截止日期", "", 2,false),
    FREEBAGGAGEALLOWANCE("freeBaggageAllowance", "免费行李", "", 3,false),

    /*
     *
     * 增值税发票卷票
     *
     * */
    //    TYPE("type", "类型"),
    //    TITLE("title", "标题"),
    //    INVOICECODE("invoiceCode", "发票代码"),
    //    INVOICENUMBER("invoiceNumber", "发票号码"),
    //    MACHINECODE("machineCode", "机器编号"),
    //    SELLERNAME("sellerName", "销售方名称"),
    //    SELLERTAXNUMBER("sellerTaxNumber", "销售方税号"),
    //    PURCHASERNAME("purchaserName", "购买方名称"),
    PURCHASERTAXCODE("purchaserTaxCode", "购买方税号", "", 1,false),
    //    INVOICEDATE("invoiceDate", "开票日期"),
    CASHIER("cashier", "收款员", "", 1,false),
    //    TOTALAMOUNTINWORDS("totalAmountInWords", "合计金额(大写)"),
    //    TOTALAMOUNT("totalAmount", "合计金额(小写)"),
    //    CHECKCODE("checkCode", "校验码"),
    //    ITEMNAME("itemName", "项目"),
    //    QUANTITY("quantity", "数量"),
    //    UNITPRICE("unitPrice", "单价"),
    //    AMOUNT("amount", "金额");

    /*
     *
     * 过路过桥费发票
     *
     * */
    //    TITLE("title", "标题"),
    //    FORMTYPE("formType", "联次"),
    //    INVOICECODE("invoiceCode", "发票代码"),
    //    INVOICENUMBER("invoiceNumber", "发票号码"),
    //    DATE("date", "日期"),
    //    TIME("time", "时间"),
    VEHICLETYPE("vehicleType", "车型", "", 1,false),
    ENTRANCENAME("entranceName", "入口", "", 1,false),
    EXITNAME("exitName", "出口", "", 1,false),
    //    TOTALAMOUNT("totalAmount", "总金额");

    /*
     *
     * 非税收入发票
     *
     * */
    //    TITLE("title", "标题"),
    //    INVOICECODE("invoiceCode", "票据代码"),
    PAYERCREDITCODE("payerCreditCode", "交款人统一社会信用代码", "", 1,false),
    PAYERNAME("payerName", "交款人", "", 1,false),
    //    INVOICENUMBER("invoiceNumber", "票据号码"),
    //    VALIDATIONCODE("validationCode", "校验码"),
    //    INVOICEDATE("invoiceDate", "开票日期"),
    //    TOTALAMOUNTINWORDS("totalAmountInWords", "合计金额（大写）"),
    //    TOTALAMOUNT("totalAmount", "合计金额（小写）"),
    ADDITIONALINFO("additionalInfo", "其他信息", "", 1,false),
    PAYEENAME("payeeName", "收款单位", "", 1,false),
    //    REVIEWER("reviewer", "复核人"),
    //    RECIPIENT("recipient", "收款人"),
    NUMBER("number", "项目编号", "", 1,false),
    NAME("name", "项目名称", "", 1,false),
    //    UNIT("unit", "单位"),
    //    QUANTITY("quantity", "数量"),
    //    SPECIFICATION("specification", "标准"),
    //    AMOUNT("amount", "金额"),
    REMARK("remark", "备注", "", 1,false);


    private String key;
    private String label;

    private String value;
    private Integer type;

    private String source;

    private Boolean required;



    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    AliBillFieldEnum() {
    }

    public static VoucherResponseVO convertVoucherVO(String key,String value){

        VoucherResponseVO vo = new VoucherResponseVO();
        for (AliBillFieldEnum fieldEnum : AliBillFieldEnum.values()) {
            if (fieldEnum.getKey().equals(key)) {
                vo.setKey(key);
                vo.setLabel(fieldEnum.getLabel());
                vo.setType(fieldEnum.getType());
                vo.setValue(value);
                vo.setRequired(fieldEnum.getRequired());
                if (fieldEnum.key.equals("flights") || fieldEnum.key.equals("invoiceDetails")) {
                    vo.setValue("");
                }
                return vo;
            }
        }
        return null;
    }

    AliBillFieldEnum(String key, String label, String value, Integer type, Boolean required) {
        this.key = key;
        this.label = label;
        this.value = value;
        this.type = type;
        this.required = required;
    }

    // AliBillFieldEnum(String key, String label, String value, Integer type) {
    //     this.key = key;
    //     this.label = label;
    //     this.value = value;
    //     this.type = type;
    // }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }



    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
}
